package com.zhxg.zcl.main;

import java.util.HashMap;
import java.util.Map;
import java.util.Vector;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import com.lowagie.text.List;
import com.zhxg.zcl.util.DataUtil;
import com.zhxg.zcl.util.FilePool;

public class testData {
	
	 private static Map info =new HashMap();

	  public static void main(String[] args) {
		
		  
		    DataUtil  data = new DataUtil();
		    
		  
		    
		   Vector vecotr = data.getAllInfo("SELECT link,source from cp_records LIMIT 2000000");
		  
		   if(vecotr==null) return;
		    
		   for(int i=0;i<vecotr.size();i++){
		    	 
		    	  String link ="";
		    	  String source="";
		    	   Map map  = (Map) vecotr.get(i);
		    	   
		    	     link =(String) map.get("link");
		    	     source =(String) map.get("source");
		    	      
		    	     if(!link.equals("")&& link !=null){
		    	    	 
		    	    	 Pattern p = Pattern.compile("(?<=//|)((\\w)+\\.)+\\w+");
		    	         Matcher m = p.matcher(link);
		    	         if(m.find()){
		    	             //System.out.println(m.group());
		    	        	if(source!=null && !source.equals("")) 
		    	        	             info.put(m.group(), source);
		    	         }

		    	     }
		    	     
		     }
		   String path ="e:\\zcl.txt";
		           FilePool.txt(info,path);
	}
	
}
